<?php
/**
* The Scribble "dashboard".
*
* Copyright (c) 2009 James Gauld <james@jamesgauld.net>
* This file is part of Scribble.
* @license http://www.scribblecms.co.uk/license.txt
*
* @package Scribble
*/
use Buan\Config;
use Buan\ExtensionManager;
class IndexController extends ScribbleAdminController {

	/**
	* Show an overview of the system with links to often-used sections.
	*
	* @param array Action parameters
	* @return View
	*/
	public function index($params) {

		// Init
		$view = new ScribbleAdminView();
		if(!$this->init($view)) {
			return $view;
		}
		$view->setSource(Config::get('ext.Scribble.dir.views').'/scribble/index/index.tpl.php');

		// Prepare secondary view
		$sView = new ScribbleAdminView();
		$sView->setSource(Config::get('ext.Scribble.dir.views').'/scribble/index/index.secondary.tpl.php');
		ScribbleAdminView::getGlobalView()->attachViewToSlot($sView, 'secondary');

		// Get all the registered dashboard widgets
		$view->widgets = ExtensionManager::get('Scribble')->getDashboardWidgets();

		// Result
		return $view;
	}
}
?>